function mid(n, arr) {

    //考虑乱序的情况
    arr = arr.sort((a, b) => {
        return a - b;
    });
    console.log(arr);
    let midIndex = n / 2;
    //外部删除
    for (let i = 0; i < arr.length; i++) {

        if (i < midIndex) {
            console.log(arr[midIndex]);
        } else {
            console.log(arr[midIndex - 1]);
        }

    }


}

mid(10, [1, 2, 3, 4, 7, 8, 9, 10, 5, 6]);